/**
 * Created by zhuyufeng on 2016/1/9.
 */
Ext.define('valuableHistroymodel', {
	extend: 'Ext.data.Model',
	fields: [ 'date','name','class','number','time','mark']
});
var valuableHistroyStore = Ext.create('Ext.data.Store', {
	model: 'valuableHistroymodel',
	autoLoad: true,
	pageSize: 4,
	proxy: {
		type: 'ajax',
		url : './json/valuableHistory',
		reader: {
			type: 'json',
			root: 'rows',
			totalProperty: 'total'
		}
	}
});
var valuableHistroy = Ext.create('Ext.grid.Panel', {
	store: valuableHistroyStore,
	columnWidth:.8,
	region:'east',
	split:true,
	border:true,
	collapsible:true,
	width:400,
	minSize:400,
	maxSize:600,
	title: '违规信息历史记录',
	columns: [
		{text: '日期',width: 100,dataIndex: 'date'},
		{text: '姓名',width: 100,dataIndex: 'name'},
		{text: '证件类别',width: 150,dataIndex: 'class'},
		{text: '证件号',width: 150,dataIndex: 'number'},
		{text: '出入时间',width: 150,dataIndex: 'time'},
		{text: '贵重物品描述',width: 150,dataIndex: 'mark'}
	],
	dockedItems:[{
		xtype:'pagingtoolbar',
		store:valuableHistroyStore,
		dock:'bottom',
		displayInfo:true,
		displayMsg:'第{0}条到第{1}条,一共{2}条',
		emptyMsg:'没有记录'
	}],
	tbar:[{
		text:'筛选',
		xtype:'button',
		arrowAlign:'right',
		menu:[
			{
				text:'通过时间筛选',
				handler:function() {
					var add_winForm = Ext.create('Ext.form.Panel', {
						frame: true,   //frame属性
						width: 340,
						bodyPadding: 5,
						fieldDefaults: {
							labelAlign: 'left',
							labelWidth: 90,
							anchor: '100%'
						},
						items: [
							{
								//日期文本框
								xtype: 'datefield', //8
								name: 'date',
								fieldLabel: '日期',
								value: new Date()
							}
						]
					});
					var syswin = Ext.create('Ext.window.Window', {
						title: "筛选",
						width: 350,
						iconCls: "addicon",
						resizable: false,         	// 不可以随意改变大小
						draggable: false,            // 是否可以拖动
						collapsible: true,         // 允许缩放条
						closeAction: 'close',
						closable: true,
						modal: 'true',             // 弹出模态窗体
						buttonAlign: "center",
						bodyStyle: "padding:0 0 0 0",
						items: [add_winForm],
						buttons: [
							{
								text: "确定",
								minWidth: 70,
								handler: function () {
									syswin.close();
								}
							},
							{
								text: "关闭",
								minWidth: 70,
								handler: function () {
									syswin.close();
								}
							}
						]
					});
					syswin.show();
				}
			}]
	}]
});
